package com.itheima.commonmodule.Result;

import com.itheima.commonmodule.enums.Code;
import lombok.Data;

@Data
public class Result {
    private Integer code;
   private String message;
   private Object data;

    public Result(Integer code, Object data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }
    public static Result success(Object data){
        Code code = Code.SUCCESS;
        return new Result(code.getCode(),data, code.getMessage());
    }
    public static Result error(String message){
        return new Result(500,null,message);
    }
}
